﻿using ConfExpert.Forms.Base;
using DevExpress.XtraGrid.Columns;
using DevTeam;
using System;

namespace ConfExpert.Forms.Planlama
{
    public partial class ModelhaneGunlukPerf : XForm
    {
        public ModelhaneGunlukPerf()
        {
            InitializeComponent();
        }

        private void ModelhaneGunlukPerf_Load(object sender, EventArgs e)
        {
            
            gridView1.Init("GetPlanlamaModelhanePerf", teDosyaNo.EditValue);
            gridView1.AddDetailGrid(gridView2, "Gun");
            gridView1.AddSummary("Adet");

            gridView1.FormatAsDate("Gun");
            //gridView1.Columns["Gun"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            //gridView1.Columns["Gun"].DisplayFormat.FormatString = "d"; //G
            gridView1.BestFitColumns();

            gridView2.FormatAsNumber(3, "OrtBirimMetraj");
            gridView2.AddSummary();
            gridView2.Columns["Gun"].Visible = false;
            gridView2.BestFitColumns();
            xDosyaNo.ItemClick += xDosyaNo_ItemClick;
            btnGetir.ItemClick += btnGetir_ItemClick;

            gridView2.Columns["DosyaNo"].OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
        }

        void btnGetir_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView1.RefreshDataSource(true, "GetPlanlamaModelhanePerf", teDosyaNo.EditValue);
        }

        void xDosyaNo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            teDosyaNo.EditValue = string.Empty;
            btnGetir.PerformClick();
        }
    }
}